<?php


namespace App\Transformers\System;


use App\Models\SystemUserLevel;
use League\Fractal\TransformerAbstract;

class SystemUserLevelTransformer extends TransformerAbstract
{
    public function transform(SystemUserLevel $data)
    {
        return [
            'id' => $data->id,
            'merchant_id' => $data->merchant_id ?? '',
            'name' => $data->name ?? '',
            'money' => $data->money ?? '',
            'valid_date' => $data->valid_date ?? '',
            'grade' => $data->grade ?? '',
            'discount' => $data->discount ?? '',
            'image' => $data->image ?? '',
            'image_url' => 'https://placeimg.com/640/480/any',
            'icon' => $data->icon ?? '',
            'icon_url' => 'https://placeimg.com/640/480/any',
            'explain' => $data->explain ?? '',
            'exp_num' => $data->exp_num ?? '',
            'is_show' => $data->is_show ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
